<?php

namespace Api\InterfaceApi\v1;

use App\AiPro\Service\AiproCategoryService;
use App\AiPro\Service\AiproWebsiteService;
use App\AiPro\Service\BrushClass;
use Hyperf\Di\Annotation\Inject;
use Mine\Annotation\Api\MApi;
use Mine\MineRequest;
use Mine\MineResponse;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;

class AiproApi
{
    /**
     * @var MineRequest|mixed
     */
    private mixed $request;
    /**
     * @var MineResponse|mixed
     */
    private mixed $response;

    /**
     * 业务处理服务
     */
    #[Inject]
    protected AiproCategoryService $service;

    /**
     * 业务处理服务
     */
    #[Inject]
    protected AiproWebsiteService $website_service;

    /**
     * FaithApi constructor.
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public function __construct()
    {
        $this->response = container()->get(MineResponse::class);
        $this->request = container()->get(MineRequest::class);

    }

    /**
     * 网站分类.
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    #[MApi(accessName: 'cateList', name: '分类列表', description: '', appId: '6fde7680da', groupId: 2)]
    public function cateList()
    {
        $res = new BrushClass();
        $res->main();
            return ;
        $params = $this->request->all();
        $params['status'] = 1;
        return $this->response->success('success', $this->service->getTreeList($params));
    }

    /**
     * 网站列表.
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    #[MApi(accessName: 'websiteList', name: '网站列表', description: '', appId: '6fde7680da', groupId: 2)]
    public function websiteList()
    {
        $params = $this->request->all();
        $params['status'] = 1;
        return $this->response->success('success', $this->website_service->getPageList($params));
    }

}